<?
	 layout("/inc/win_layout.html",{title:sysTitle}){
    ?>
<div class="panel" style="height: 610px; overflow: auto;">
	<div class="panel-body pan" >
		<div class="row" style="margin-bottom: 10px;">
		<div class="col-lg-6"
				style="width: 400px; float:left; margin-right:-20px; display:inline;">
				<label for="inputUsername" class="col-md-3 control-label">登录方式
				<span class='require'>*</span>
			</label> 
			<div class="col-md-9">
					<div class="input-icon">
			<select id="type" class="form-control">
				<option value="0">新浪微博</option>
				<option value="1">QQ互联</option>
				<option value="2">微信登录</option>
			</select>
		</div>
		</div>
		</div>
		</div>
		<div class="row" style="margin-bottom: 10px;">
			<div class="col-lg-6"
				style="width: 400px; float:left; margin-right:-20px; display:inline;">
				<label for="inputUsername" class="col-md-3 control-label">appid
					</label>
				<div class="col-md-9">
					<div class="input-icon">
						<input id="appid" type="text" class="form-control" value="" />
					</div>
				</div>
			</div>
			</div>
			<div class="row" style="margin-bottom: 10px;">
			<div class="col-lg-6"
				style="width: 400px; float:left; margin-right:-20px;display:inline;">
				<label for="inputUsername" class="col-md-3 control-label">appsecret
				 </label>
				<div class="col-md-9">
					<div class="input-icon">
						<input id="appsecret" type="text" class="form-control" value="" />
					</div>
				</div>
			</div>
		</div>
		</div>
		</div>
<?} ?>
<script>
	var index1 = window.parent.getlay();
	$(function() {
		if(index1 != 0){
			$.ajax({
			type : "post",
			url : "./openLoginUpdate.do",
			data : {
				"id" : index1,
			},
			dataType : "json",
			async : false,
			success : function(data) {
				$("#appid").val(data[0].appid);
				$("#appsecret").val(data[0].appsecret);
				selected("type",data[0].type);
			
			},
			error : function(data) {
				alert("请求失败");
			}
		});
		}
		
	});

var index1 = window.parent.getlay();
function Page(){
$.ajax({
			type : "post",
			url : "./settingAdd.do",
			data : {
				"id" : index1,
				"appid" : $("#appid").val(),
				"appsecret" : $("#appsecret").val(),
				"type" : $("#type").val(),
			},
			dataType : "json",
			async : false,
			success : function(data) {
				var index = parent.layer.getFrameIndex(window.name);
				window.parent.get();
				parent.layer.msg('提交成功');
				parent.layer.close(index);
			},
			error : function(data) {
				alert("请求失败");
			}
		});
	}
		//   默认单选函数
		function selected(selectname, selectid) {
			$("#" + selectname + " option").each(function() { //遍历全部option
				var v = $(this).val(); //获取option的内容
				if (v == selectid) {
					$(this).attr("selected", "selected");
				}
			});
		}	
</script>